package com.vegas.netspider.apps.checker;

import java.util.regex.Pattern;




public class SimpleContentChecker implements ContentChecker {

	private Pattern pattern;
	private Class<? extends RuntimeException> expClass;
	
	public void setRegex(String regex){
		pattern = Pattern.compile(regex);
	}
	
	@Override
	public void check(String content) throws Exception {
		boolean b = pattern.matcher(content).find();
		if(b){
			throw expClass.newInstance(); 
		}
	}

	public void setExpClass(Class<? extends RuntimeException> expClass) {
		this.expClass = expClass;
	}
	
}
